<?php
namespace UserApi\Controller;
use Zend\Mvc\Controller\AbstractRestfulController;
use Zend\View\Model\JsonModel;
class ShopregistationApiController extends AbstractRestfulController
{
    public function getList()
    {			
			
    }
    public function get($user_id)
    {		
    }
    public function create($shopdata)
    {
		header('Access-Control-Allow-Origin: *');	
		$userTable=$this->getServiceLocator()->get('Models\Model\UserFactory');
		$notificationTable=$this->getServiceLocator()->get('Models\Model\NotificationsFactory');
		$userDetailsTable=$this->getServiceLocator()->get('Models\Model\UserDetailsFactory');
		$Shopregistration= $userTable->saveshopData($shopdata);
		$ShopregistrationDetails = $userDetailsTable->saveshopDetails($shopdata,$Shopregistration);
		$saveregistrationmotification = $notificationTable->sendAdminComplaint($shopdata,'2','0','0','0','1');
		if($ShopregistrationDetails!=0){
			return new JsonModel(array(
				'UserId'	=>	$Shopregistration,
			));
		}else{
			return new JsonModel(array(
				'UserId'	=>	0,
			));
		}
    }
    public function update($uid, $data)
    {
		header('Access-Control-Allow-Origin: *');	
		$userTable=$this->getServiceLocator()->get('Models\Model\UserFactory');
		$userDetailsTable=$this->getServiceLocator()->get('Models\Model\UserDetailsFactory');
		$userRegistration = $userTable->updateUserData($data,$uid);
		$userRegistrationDetails = $userDetailsTable->updateUserDetails($data,$uid);
		if($userRegistrationDetails){
			return new JsonModel(array(
				'output' => 'success',
				'value' => 1,
			));
		}else{
			return new JsonModel(array(
				'output' => 'fail',
				'value' => 0,
			));
		}
    }
    public function delete($id)
    {
       
    }
}